package zyq;

import java.io.IOException;
import java.io.Reader;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import zyq.po.User;

public class Test {

    public static void main(String[] args) {
        try {
            Reader reader = Resources.getResourceAsReader("mybatis-conf.xml");
            SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
            SqlSession session = sqlSessionFactory.openSession();
            //1是给selectUserByID传入的参数
            User user = (User) session.selectOne("zyq.dao.UserMapper.selectUserByID", 1);
            System.out.println(user.toString());
            session.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
